home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1996 / MacHack 1996.toast / Hacks / Hacks ’87 / Source ƒ.sit / Source ƒ / C ƒ / TRANS-LSC / MiniDisplay.c < prev    next >
Encoding:
C/C++ Source or Header  |  1986-11-04  |  1.9 KB  |  72 lines  |  [TEXT/KAHL]

  1. /*
  2.     MiniDisplay - TransDisplay Demonstration.  Very simple:  just
  3.     demonstrates the various output calls.
  4.  
  5.     The project should include MiniDisplay.c (this file),
  6.     TransDisplay.c (or a project made from TransDisplay.c),
  7.     TransSkel.c (or a project made from TransSkel.c), and MacTraps.
  8.  
  9.     4 October 1986        Paul DuBois
  10. */
  11.  
  12. # include    <MenuMgr.h>
  13. # include    "TransDisplay.h"
  14.  
  15.  
  16.  
  17. DoFileMenu (item)
  18. int        item;                    /* ignored - there's only Quit */
  19. {
  20.     SkelWhoa ();                /* tell SkelMain to quit */
  21. }
  22.  
  23.  
  24. main ()
  25. {
  26. Rect        r;
  27. MenuHandle    m;
  28. WindowPtr    w;
  29.  
  30.     SkelInit ();                    /* initialize */
  31.     SkelApple (nil, nil);            /* handle desk accessories */
  32.  
  33.     m = NewMenu (2, "\pFile");        /* create menu */
  34.     AppendMenu (m, "\pQuit/Q");
  35.     SkelMenu (m, DoFileMenu, nil);    /* tell TransSkel to handle it */
  36.  
  37.     SetRect (&r, 100, 75, 400, 250);
  38.     w = NewDWindow (&r, "\pMiniDisplay", false, -1L, false, 0L);
  39.  
  40.     DisplayString ("\pThis is MiniDisplay, a minimal demonstration of ");
  41.     DisplayString ("\pTransDisplay.  The following types of output may ");
  42.     DisplayString ("\pbe written with the built-in output calls:\r");
  43.  
  44.     DisplayString ("\p\rArbitrary length text: ");
  45.     DisplayText ("Some text", 9L);
  46.     DisplayString ("\p\rString: ");
  47.     DisplayString ("\p\"\\pThis is a string.\"");
  48.     DisplayString ("\p\rChar: '");
  49.     DisplayChar ('x');
  50.     DisplayString ("\p'    Hex char: ");
  51.     DisplayHexChar ('x');
  52.     DisplayString ("\p\rInt: ");
  53.     DisplayInt (1023);
  54.     DisplayString ("\p    Hex int: ");
  55.     DisplayHexInt (1023);
  56.     DisplayString ("\p\rLong: ");
  57.     DisplayLong (32768L);
  58.     DisplayString ("\p  Hex long: ");
  59.     DisplayHexLong (32768L);
  60.     DisplayString ("\p\rBoolean: ");
  61.     DisplayBoolean (true);
  62.     DisplayString ("\p, ");
  63.     DisplayBoolean (false);
  64.     DisplayString ("\p\rCarriage return. ");
  65.     DisplayString ("\p\r\rSelect Quit from the File menu to exit.");
  66.     SetDWindowPos (w, 0);    /* scroll back to top */
  67.     ShowWindow (w);
  68.  
  69.     SkelMain ();                    /* loop 'til Quit selected */
  70.     SkelClobber ();                    /* clean up */
  71. }
  72.